package com.jiayang.hhotel.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import com.jiayang.hhotel.R;
import com.jiayang.hhotel.adapter.RealNameListAdapter;
import com.jiayang.hhotel.bean.Constant;
import com.jiayang.hhotel.presenter.PersonInfoPresenter;
import com.jiayang.hhotel.view.CircleImageView;

import cn.droidlover.xdroidmvp.mvp.XActivity;

/**
 * Created by Administrator on 2017/6/8 0008.
 * 个人信息页面（我的）
 */

public class PersonInfoActivity extends XActivity<PersonInfoPresenter> implements View.OnClickListener {

    private CircleImageView head;
    private Button repair;//更换个人信息
    private ListView list;//个人信息列表
    private TextView isSign;//是否已实名认证显示控件
    private Button commontVisit;//常用旅客按钮

    private RealNameListAdapter adapter;

    @Override
    public void initData(Bundle savedInstanceState) {
        head = (CircleImageView) findViewById(R.id.head_iv);
        repair = (Button) findViewById(R.id.bt_repair_sign);
        list = (ListView) findViewById(R.id.lv);
        isSign = (TextView) findViewById(R.id.is_sign);
        commontVisit = (Button) findViewById(R.id.bt_commont);

        repair.setOnClickListener(this);
        commontVisit.setOnClickListener(this);
    }

    @Override
    public int getLayoutId() {
        return R.layout.layout_person_info;
    }

    @Override
    public PersonInfoPresenter newP() {
        return new PersonInfoPresenter();
    }

    private void setAdapter(){
        if(adapter == null){
//            adapter = new RealNameListAdapter(this,nameList,contentList);
            list.setAdapter(adapter);
        }else{
            adapter.notifyDataSetChanged();
        }
    }

    private Intent intent;
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_repair_sign://重新认证
                intent = new Intent(this,CertificationActivity.class);
                intent.putExtra(Constant.INTENT_INT_KEY,123456);
                startActivity(intent);
                break;
            case R.id.bt_commont://常用旅客(联系人)
                intent = new Intent(this,ContactPersonActivity.class);
                startActivity(intent);
                break;
        }
    }
}
